import { writeFile, readFile } from "fs";
export const writeFileAsync = (src, data) => {
  return new Promise((resolve, reject) => {

    writeFile(src, data, function(err, res) {
      if (err) reject(err);
      resolve("save success");
    });
  });
};

export const readFileAsync = (src, type = "UTF-8") => {
  return new Promise((resolve, reject) => {
    readFile(src, type, function(err, data) {
      if (err) reject(err);
      resolve(data);
    });
  });
};
